package com.syf.config.result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 全局web拦截器【配置 拦截路径】
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

//	@Bean
//	public ResponseResultInterceptor responseResultInterceptor() {
//		return new ResponseResultInterceptor();
//	}

//	@Autowired
//	private ResponseResultInterceptor responseResultInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
    //响应结果控制拦截
		registry.addInterceptor(new ResponseResultInterceptor()).addPathPatterns("/**");
	}
}
